home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / pupworld.swf / scripts / __Packages / Heroes / EndOfLevelScreen.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  1.5 KB  |  56 lines

  1. class Heroes.EndOfLevelScreen extends MovieClip
  2. {
  3.    var intelligence;
  4.    var time;
  5.    var score;
  6.    var grade;
  7.    var level;
  8.    var tags;
  9.    var warnings;
  10.    var intelligenceM = 5;
  11.    var timeM = 2;
  12.    function EndOfLevelScreen()
  13.    {
  14.       super();
  15.       this.intelligence = Math.round(Heroes.Tools.getIntelligence() * this.intelligenceM);
  16.       this.time = Math.round(Heroes.Tools.getLevelTime() * this.timeM);
  17.       this.score = Math.round(Heroes.Tools.getScore() + this.intelligence + this.time);
  18.       this.grade = "F";
  19.       if(this.score > 2500)
  20.       {
  21.          this.grade = "C";
  22.       }
  23.       if(this.score > 2900)
  24.       {
  25.          this.grade = "B";
  26.       }
  27.       if(this.score > 3100)
  28.       {
  29.          this.grade = "A";
  30.       }
  31.       if(this.score > 3400)
  32.       {
  33.          this.grade = "A+";
  34.       }
  35.       trace("grade = " + this.grade);
  36.       Heroes.Tools.setGrade(this.grade);
  37.    }
  38.    function onEnterFrame()
  39.    {
  40.       this.tags.gotoAndStop("tag" + this.level);
  41.       this.warnings.gotoAndStop("warning" + this.level);
  42.    }
  43.    function nextLevel()
  44.    {
  45.       Heroes.Tools.setScore(this.score);
  46.       this._parent.play();
  47.    }
  48.    function printCertificate()
  49.    {
  50.       this._parent.printCertificate.name_txt.text = Heroes.Tools.getPlayerName();
  51.       this._parent.printCertificate.date_txt.text = Heroes.Tools.getDateString();
  52.       this._parent.printCertificate.grade_txt.text = Heroes.Tools.getGrade();
  53.       print(this._parent.printCertificate,"bframe");
  54.    }
  55. }
  56.